package com.niodata.dp.task;

import com.niodata.dp.task.entity.PluginPackage;
import java.io.IOException;
import java.io.InputStream;

public interface PluginPackageStore {

  /**
   * save uploaded package file to store dir.
   *
   * @param packageStream uploaded package zip
   * @return JobPackage
   * @throws IOException throws io exception
   */
  public PluginPackage savePluginFile(InputStream packageStream,
      String pkgName, String pkgVersin) throws Exception;

  /**
   * copy plugin to local dir.
   *
   * @param name plugin name
   * @param version plugin version
   * @throws IOException ex
   */
  public void copyPluginFilesToLocal(String name, String version) throws IOException;


  /**
   * copy plugin to local dir.
   *
   * @param name plugin name
   * @param version plugin version
   * @param dir local dir
   * @throws IOException ex
   */
  public void copyPluginFilesToLocal(String name, String version, String dir) throws IOException;


  /**
   * get plugin local store cache dir.
   *
   * @return localStore path
   */
  public String getLocalStorePath();

  public String getPluginLocalStorePath(String name, String version);

  /**
   * get plugin remote store dir.
   *
   * @return remote store path
   */
  public String getRemoteStorePath();

  public boolean localExists(String name, String version);

  public boolean exists(String name, String version) throws IOException;

  public void removePluginFile(String name, String version) throws IOException;

  public String getPluginStorePath(String name, String version);

  //public String getPackageStoreLocation();

}
